package fr.smile.liferay.portlet.news.messaging;

import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.messaging.Message;
import com.liferay.portal.kernel.messaging.MessageListener;

import fr.smile.liferay.portlet.news.service.NewsEntryLocalServiceUtil;

public class CheckEntryMessageListener implements MessageListener {

	public void receive(Message message) {
		try {
			doReceive(message);
		} catch (Exception e) {
			LOG.error("Unable to process message " + message, e);
		}
	}

	protected void doReceive(Message message) throws Exception {
		LOG.warn("message received");
		NewsEntryLocalServiceUtil.checkEntries();
	}

	private static final Log LOG = LogFactoryUtil.getLog(CheckEntryMessageListener.class);

}